package com.gsx.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpSession;

@Controller
public class normalPeopleLogin {
    @GetMapping("/log")
    public String login(){
        return "login";
    }

    @GetMapping("/fail")
    public String fail(RedirectAttributes attributes){
        attributes.addFlashAttribute("message","用户名或者密码错误");
        System.out.println("");
        return "redirect:/log";
    }

    @GetMapping("/out")
    public String logout(HttpSession httpSession){
        httpSession.removeAttribute("user");
        return "redirect:/";
    }
}
